<HTML>
<HEAD>
<TITLE>[Chapter 20] java.awt.datatransfer Reference</TITLE>
<META NAME="author" CONTENT="John Zukowski">
<META NAME="date" CONTENT="Thu Jul 31 15:18:53 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java AWT">
<META NAME="title" CONTENT="Java AWT">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java AWT" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch19_61.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 20</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch20_02.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<H1 CLASS=chapter><A CLASS="TITLE" NAME="JAWT-CH-20">20. java.awt.datatransfer Reference</A></H1>

<DIV CLASS=htmltoc>

<p>
<b>Contents:</b><br>
Clipboard <img src="gifs/bstar.gif" alt="(New)" border=0><br>
<A HREF="ch20_02.htm">ClipboardOwner <img src="gifs/bstar.gif" alt="(New)" border=0></A><BR>
<A HREF="ch20_03.htm">DataFlavor <img src="gifs/bstar.gif" alt="(New)" border=0></A><BR>
<A HREF="ch20_04.htm">StringSelection <img src="gifs/bstar.gif" alt="(New)" border=0></A><BR>
<A HREF="ch20_05.htm">Transferable <img src="gifs/bstar.gif" alt="(New)" border=0></A><BR>
<A HREF="ch20_06.htm">UnsupportedFlavorException <img src="gifs/bstar.gif" alt="(New)" border=0></A><BR>

<p>
</DIV>

<DIV CLASS=refnamediv>
<H1>Clipboard <img src="gifs/bstar.gif" alt="(New)" border=0></H1>

<H2>Name</H2>

Clipboard <img src="gifs/bstar.gif" alt="(New)" border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch20-REFSECT1-AUTOID.1"></A></h2>
</DIV>


<p>
<img align=middle src="./figs/clipboa.gif" alt="[Graphic: Figure from the text]" width=502 height=52 border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch20-REFSECT1-AUTOID.2">Description</A></h2>

<P CLASS=para>
The <tt CLASS=literal>Clipboard</tt> class is a repository for a
<tt CLASS=literal>Transferable</tt> object and can be used for cut, copy,
and paste operations. The system clipboard can be accessed by calling
<tt CLASS=literal>Toolkit.getDefaultToolkit().getSystemClipboard()</tt>.
You can use this technique if you are interested in exchanging data
between your application and other applications (&nbsp;&nbsp;Java or non-Java)
running on the system. In addition, <tt CLASS=literal>Clipboard</tt> can
be instantiated directly, if "private" clipboards are
needed.

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch20-REFSECT1-AUTOID.3">Class Definition</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public class java.awt.datatransfer.Clipboard
   extends java.lang.Object {
  // Variables
  protected Transferable contents;
  protected ClipboardOwner owner;
  // Constructors
  public Clipboard (String name);
  // Instance Methods
  public synchronized Transferable getContents (Object requestor);
  public String getName();
  public synchronized void setContents (Transferable contents, ClipboardOwner owner);
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch20-REFSECT1-AUTOID.4">Variables</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch20-REFSECT2-AUTOID.1">contents</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch20-REFSECT3-AUTOID.1">protected Transferable contents</A></h4>

<P CLASS=para>
The object that the <tt CLASS=literal>Clipboard</tt> 
contains, i.e., the object that has been cut or copied. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch20-REFSECT2-AUTOID.2">owner</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch20-REFSECT3-AUTOID.2">protected ClipboardOwner owner</A></h4>

<P CLASS=para>
The object that owns the <tt CLASS=literal>contents</tt>. 
When something else is placed on the clipboard, owner 
is notified via lostOwnership(). 

</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch20-REFSECT1-AUTOID.5">Constructors</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch20-REFSECT2-AUTOID.3">Clipboard</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch20-REFSECT3-AUTOID.3">public Clipboard (String name)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>name</I><br>
<DD>

<P CLASS=para>
The 
name for this <tt CLASS=literal>Clipboard</tt>. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a <tt CLASS=literal>Clipboard</tt> object 
with the given <tt CLASS=literal>name</tt>. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch20-REFSECT1-AUTOID.6">Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch20-REFSECT2-AUTOID.4">getContents</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch20-REFSECT3-AUTOID.4">public synchronized Transferable getContents (Object requestor)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>requestor</I><br>
<DD>

<P CLASS=para>
The 
object asking for the contents. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
An object that implements the <tt CLASS=literal>Transferable</tt> 
interface. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Returns the current contents of the <tt CLASS=literal>Clipboard</tt>. 
You could use this method to paste data from the clipboard into your application. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch20-REFSECT2-AUTOID.5">getName</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch20-REFSECT3-AUTOID.5">public String getName()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Clipboard</tt>'s name. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Returns the name used when this clipboard was constructed. <tt CLASS=literal>Toolkit.getSystemClipboard()</tt> 
returns a <tt CLASS=literal>Clipboard</tt> named "System". </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch20-REFSECT2-AUTOID.6">setContents</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch20-REFSECT3-AUTOID.6">public synchronized void setContents (Transferable contents, ClipboardOwner owner)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P CLASS=para>
<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>contents</I><br>
<DD>

<P CLASS=para>
New contents.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>owner</I><br>
<DD>

<P CLASS=para>
Owner of the new contents. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Changes the contents of the <tt CLASS=literal>Clipboard</tt>. 
You could use this method to cut or copy data from your application to 
the clipboard. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch20-REFSECT1-AUTOID.7">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>ClipboardOwner</tt>, <tt CLASS=literal>Toolkit</tt>, 
<tt CLASS=literal>Transferable</tt> 

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch19_61.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch20_02.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>Window</td>
<td width=171 align=center valign=top><a href="index/idx_a.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>ClipboardOwner <img src="gifs/bstar.gif" alt="(New)" border=0></td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
